 $(function(){
		$("#addWeChatNews").click(function(){
			 var title = $('#title').val();
			 var classify = $('#classify option:selected').val();
			 var imgurl =$('#imgurl').val();
			 var summary=$('#summary').val();
			 var detail =$('#editor').val();
			 var wechatnew = {"title":title ,"classify":classify,"imgurl":imgurl,"summary":summary,"detail":detail};
			 
			  $.ajax({ 
                type : "post",                                             
                url : "addWechatNews",
                dataType:"json", 
                contentType:"application/json",
                data:JSON.stringify(wechatnew),
                
                success : function(data) {
                	
				    alert(data.message);
				    var index = parent.layer.getFrameIndex(window.name);
				    window.parent.location.reload();
				    // 关闭当前frame
				    parent.layer.close(index);
                 
                   
                },
                error : function() {
                    alert("添加失败");
                }
            });	
		});
		});
 

 $(function(){
		$("#updateWeChatNews").click(function(){
			 var id =$('#id').val();
			 var title = $('#title').val();
			 var classify = $('#classify option:selected').val();
			 var imgurl =$('#imgurl').val();
			 var summary=$('#summary').val();
			 var detail =$('#editor').val();
			 var wechatnew = {"title":title ,"classify":classify,"imgurl":imgurl,"summary":summary,"detail":detail,"id":id};
			 
			  $.ajax({ 
           type : "post",                                             
           url : "updateWechatNews",
           dataType:"json", 
           contentType:"application/json",
           data:JSON.stringify(wechatnew),
           
           success : function(data) {
           	
				    alert(data.message);
				    var index = parent.layer.getFrameIndex(window.name);
				    window.parent.location.reload();
				    // 关闭当前frame
				    parent.layer.close(index);
            
              
           },
           error : function() {
               alert("添加失败");
           }
       });	
		});
		});

 